<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.dateWidth1 {
	width: 195px;
}

.select_width {
	width: 130px;
}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />

<table class="t_css" width="100%" border="0" cellpadding="0"
	id="basicInfo" cellspacing="1">
	<tr>
		<td colspan="6" class="t_bar2">基本信息（金额单位：万元）</td>

	</tr>
	<tr>
		<td align="right" style="width: 13%"><span class="color_red">*</span>企业名称：</td>
		<td colspan="5"><input id="zh_title" name="proposal/zh_title"
			label="企业名称" type="text" required
			class="input_css required maxlength:100" style="width: 725px;"
			maxlength="100"
			value="<x:out select="$xmlData/data/proposal/zh_title" />" /></td>
	</tr>
	<tr>
		<td align="right" nowrap="nowrap"><span class="color_red">*</span>进入重点园区名称：</td>
		<td colspan="3"><input id="pd_title" name="proposal/pd_title"
			label="进入重点园区名称" type="text" required
			class="input_css required maxlength:100"
			maxlength="100" style="width: 350px;"
			value="<x:out select="$xmlData/data/proposal/pd_title" />" /></td>
		<td align="right" nowrap><span class="color_red">*</span>进入年份：</td>
		<td><input name="proposal/pd_year" label="进入年份" type="text" style="width: 108px;"
			class="input_css required year" maxlength="4" onfocus="InitInput.setNumber(this,7,0,0)"
			value="<x:out select="$xmlData/data/proposal/pd_year" />" /></td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>重点园区类别：</td>
		<td nowrap  valign="middle" colspan="5">
		<label> <input type="radio" class="do " id="advant_01" style="vertical-align: middle;" name="research" label="国家级物流园区" value="01" /><span style="vertical-align: middle;">国家级物流园区</span></label> 
		<label> <input type="radio" class="do " id="advant_02" style="vertical-align: middle;" name="research" label="省级物流园区" value="02" /><span style="vertical-align: middle;">省级物流园区</span></label> 
		<label> <input type="radio" class="do " id="advant_03" style="vertical-align: middle;" name="research" label="市级物流园区" value="03" /><span style="vertical-align: middle;">市级物流园区</span></label>
		<label> <input type="radio" class="do " id="advant_04" style="vertical-align: middle;" name="research" label="其他物流园区" value="04" /><span style="vertical-align: middle;">其他物流园区</span></label>
		<input type="hidden" name="proposal/research_value" id="research_value" class="required" value="<x:out select="$xmlData/data/proposal/research_value" />" label="重点园区类别" /> 
		<input type="hidden" name="proposal/research_name" id="research_name" value="<x:out select="$xmlData/data/proposal/research_name" />" label="重点园区类别" /></td>
	</tr>
	<tr >
	<td align="right" style="width: 13%">上年度销售收入：</td>
	<td style="width: 20%">
	<input type="hidden" id="sell1" name="invests/sell_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/income" />"/>
	<span name="invests/sell" id="sell2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/income" /></span></td>
	<td align="right" style="width: 13%">上年度利润总额：</td>
	<td style="width: 20%">
	<input type="hidden" id="profit1" name="invests/profit_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/proft_total" />"/>
	<span name="invests/profit" id="profit2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/proft_total" /></span></td>
	<td align="right" style="width: 13%">上年度税收总额：</td>
	<td style="width: 21%">
	<input type="hidden" id="tax1" name="invests/tax_2011" value="<x:out select="$xmlData/data/organization/finances/finance[@sequence_no='3']/fax" />"/>
	<span name="invests/tax" id="tax2"><x:out select="$xmlData/data/organization/finances/finance[@sequence_no='5']/fax" /></span></td>
	</tr>
	
	<tr>
	    <td  align="right" nowrap><span class="color_red">*</span>申报日期：</td>
		<td colspan="5">
			<c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date" /></c:set>
			<cpt:date id="submit_date" name="proposal/submit_date" value="${submit_date}" className=" required date" label="申报日期"></cpt:date> 
		</td>
	</tr>
</table>
<table class="t_css" width="100%" border="0" cellpadding="0"
	id="basicInfo3" cellspacing="1">
		<col style="width:20%">
		<col style="width:30%">
		<col style="width:20%">
		<col style="width:30%">
	<tr>
		<td colspan="4" class="t_bar2">申请项目资金情况（金额单位：万元）</td>

	</tr>
	<tr>
		<td align="right">项目类别：</td>
		<td><x:out select="$xmlData/data/proposal/grant_name" /></td>
		<td align="right">支持方式：</td>
		<td colspan="1"><span name="proposal/sponsor_category"><x:out
					select="$xmlData/data/proposal/sponsor_category" /></span></td>

	</tr>
	<tr>
	
		
		<td align="right"><span class="color_red">*</span>申请金额：</td>
		<td  >
			<input id="source_apply" name="proposal/total_funds" style="text-align:right;" onfocus="InitInput.setNumber(this,7,4,2)" label="申请金额" type="text" required class="input_css required"   maxlength="20" value="<x:out select="$xmlData/data/proposal/total_funds" />"/> 
		</td>
		<td  align="right">资金级次：</td>
		<td colspan="1">
		<span  name="proposal/fund_level">市级</span>
		</td>
	</tr>

	<tr>
		<td align="right" nowrap>归口管理部门：</td>
		<td><span name="proposal/org_name">无锡市发展和改革委员会</span></td>
		<td align="right">管理类别：</td>
		<td colspan="1"><span name="proposal/manage_category"><x:out
					select="$xmlData/data/proposal/manage_category" /></span></td>

	</tr>
	
	<tr style="display: none">
		<td colspan="4"></td>
	</tr>
	<tr>
		<td align="right" nowrap><span class="color_red">*</span>项目所属产业：</td>
		<td nowrap colspan="3"><c:set var="industry">
				<x:out select="$xmlData/data/proposal/industry_value" />
			</c:set> <cpt:checkbox key="industry" name="industry" repeatColumn="7"
				style="border: 0px; padding: 0px; margin: 0px;float:left;"></cpt:checkbox>
			<input type="hidden" id="industry_value"
			name="proposal/industry_value" class="required" value="${industry}"
			label="项目所属产业"> <input type="hidden"
			name="proposal/industry_name"
			value="<x:out select="$xmlData/data/proposal/industry_name" />">
		</td>
	</tr>
	<tr>
		<td align="right">功能分类：</td>
		<td colspan="3"><span name="proposal/grant_function"><x:out
					select="$xmlData/data/proposal/grant_function" /></span></td>

	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1">
	<tr>
		<td class="t_bar2">申请资助依据条款</td>

	</tr>
	<tr>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
			name="proposal/policy_foundation"><x:out
					select="$xmlData/data/proposal/policy_foundation" /></span>
		</td>
	</tr>
</table>
<br />

<div class="t_bar"><span class="color_red">*</span>企业概述</div>
   <table class="t_css" width="100%" border="0" cellpadding="0" id="basicInfo4"
	    cellspacing="1">
      <tr class="li_1">
          <td align="left"><strong>企业概述：简要概括企业主要工作、发展前景以及进入重点园区后对企业的带动作用</strong>（限400字）</td>
      </tr>
      <tr class="li_2">
          <td>
			<textarea rows="5" cols="150"  class="input_textarea required  maxlength:400"   name='proposal/goal/summary1'  label="企业概述"><x:out select="$xmlData/data/proposal/goal/summary1"/></textarea>
		   <input type='hidden' name='proposal/goal/summary1_hidden' id='proposal/goal/summary1_hidden' value=''>
		  </td>
      </tr>
     </table>



<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1" id="basicInfo5">
	<tr>
		<td class="t_bar2" colspan="8">人员信息</td>

	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>项目联系人：</td>
		<td><input name="proposal/contact_psn_cname" label="项目联系人"
			type="text" required class="input_css required" maxlength="100"
			value="<x:out select="$xmlData/data/proposal/contact_psn_cname" />" />
		</td>
		<td align="right"><span class="color_red">*</span>联系电话：</td>
		<td><input name="proposal/contact_psn_tel" label="联系电话"
			type="text" required class="input_css required" maxlength="50"
			value="<x:out select="$xmlData/data/proposal/contact_psn_tel" />" />
		</td>
		<td align="right"><span class="color_red">*</span>联系手机：</td>
		<td><input name="proposal/contact_psn_mobile" label="联系手机"
			type="text" required maxlength="11" required
			class="input_css required mobile" maxlength="20"
			value="<x:out select="$xmlData/data/proposal/contact_psn_mobile" />" />
		</td>
		<td align="right"><span class="color_red">*</span>电子邮箱：</td>
		<td><input name="proposal/contact_psn_email" label="电子邮箱"
			type="text" required class="input_css required email" maxlength="100"
			value="<x:out select="$xmlData/data/proposal/contact_psn_email" />" />
		</td>
	</tr>
	<tr>
		<td  align="right">项目负责人：</td>
		<td>
			<input  name="proposal/fzr_psncode" type="hidden" required class="input_css "   maxlength="20" value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/psn_code" />"/> 
		    
		    <span name="proposal/fzr_psnname" ><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name" /></span>
		    <c:set var="psnCode"><x:out select="$xmlData/data/proposal/psn_code" /></c:set>
		    <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
				<span id="personSelect">
				<input type="button" class="button_02" style="height: 25px; padding: 1px;" id="selectPsn" value="设置">
				<cpt:personSelect key="personSelect"  addRole="3"  psnCode="${psnCode}" callback="selectPsnCall" bindEvent="click" bindObject="selectPsn" title="设置项目负责人" fltFile="personSelector.ftl"></cpt:personSelect>
				</span>
			</security:authorize>
		
		</td>
		<security:authorize ifNotGranted="A_DAILU_PROPOSAL"> 
		<td  align="right">联系电话：</td>
		<td  >
		<span name="proposal/fzr_tel"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/tel_work" /></span>
		</td>
		<td  align="right">联系手机：</td>
		<td  >
		<span name="proposal/fzr_mobile"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile" /></span>
		</td>
		</security:authorize>
		<security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
		<td  align="right"><span class="color_red">*</span>联系电话：</td>
		<td  >
		<input name="proposal/fzr_tel" label="项目负责人联系电话" type="text" required  class="input_css required"  onchange="synFzrMsg(1)"  maxlength="50"  value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/tel_work" />"/>
		</td>
		<td  align="right"><span class="color_red">*</span>联系手机：</td>
		<td  >
		<input name="proposal/fzr_mobile" label="项目负责人联系手机" type="text" onchange="synFzrMsg(1)" onfocus="InitInput.setNumber(this,11,0,0)"  maxlength="11"  class="input_css required mobile"   value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile" />"/>
		</td>
		</security:authorize>
		<td  align="right">电子邮箱：</td>
		<td  >
		<span name="proposal/fzr_mail"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/email" /></span>
		</td>
		
		</tr>


</table>

<script type="text/javascript">


$(function(){
	$("#total_assets").text(formatVal2($("#finance_930_4").text().replace(new RegExp("\,","g"), "")));
	$("#net_asset").text(formatVal2($("#finance_931_4").text().replace(new RegExp("\,","g"), "")));
	$("#business_sale").text(formatVal2($("#finance_90_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_add").text(formatVal2($("#finance_920_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_business").text(formatVal2($("#finance_921_4").text().replace(new RegExp("\,","g"), "")));
	$("#total_organization").text(formatVal2($("#finance_922_4").text().replace(new RegExp("\,","g"), "")));
	countFundSpanAuto("total_","add,business,organization","total");
	
	//总部功能
	var chkLast = $("input[name='office_function']:last");
	var chkTd = chkLast.parent("td");
	var chk_characteristic_table = chkTd.parent("tr").parent("tbody");
	chk_characteristic_table.parent("table").attr("border","0");
	var trLen = chk_characteristic_table.find("tr").length;
	var tdLen = chk_characteristic_table.find("td").length;
	var tdNum = parseInt(tdLen%trLen==0 ? tdLen/trLen : (tdLen/trLen+1));
	chkTd.append('&nbsp;<input type="text" style="display:none" id="office_function_other" maxlength="20" name="proposal/office_function_other" value="${office_function_other}"/>');
	chkTd.attr("colspan", (1+tdNum));
	var chkOther = $("#office_function_other");
	if ($.trim(chkTd.text())=="其他" && chkLast.attr("checked")=="checked") {
		chkOther.show();
	}
	chkOther.keyup(function(){
		setChkValues("office_function");
	});
	
	regChkClickAction("office_function");//给checkbox注册点击事件
});

/**
 * 给checkbox注册点击事件
 */
function setChkValues(chkName) {
	var str_value = "";
	var str_name = "";
	var text = "";
	$("input[name='"+chkName+"']:checked").each(function(){
		str_value += "，"+$(this).val();
		text = $.trim($(this).parent().text());
		if (text == "其他" && chkName == "office_function") {
			if ($.trim($("#"+chkName+"_other").val()) != "")
				str_name += "，"+$("#"+chkName+"_other").val();
		} else {
			str_name += "，"+text;
		}
	});
	if (str_value.length > 0) {
		$("input[name$='"+chkName+"_value']").val(str_value.substring(1));
		$("input[name$='"+chkName+"_name']").val(str_name.substring(1));
	}
}
function regChkClickAction(chkName) {
	$("input[name='"+chkName+"']").click(function(){
		if (chkName == "office_function" && $.trim($(this).parent("td").text()) == "其他") {
			if ($(this).attr("checked") == "checked") {
				$("#"+chkName+"_other").show();
			}
			else {
				$("#"+chkName+"_other").hide();
				$("#"+chkName+"_other").val("");
			}
		}
		setChkValues(chkName);
	});
}





function setPre(){
	var  teach_staff=$("#teach_staff").val();
    var staff_total=$("#staff_total").val();
    $("#teach_staff_pre").val(formatVal(teach_staff*100/staff_total));
    
    var  research_staff=$("#research_staff").val();
   
    $("#research_staff_pre").val(formatVal(research_staff*100/staff_total));
    
    var  technology_staff=$("#technology_staff").val();
   
    $("#technology_staff_pre").val(formatVal(technology_staff*100/staff_total));
	
}

function countFundSpanAuto(idStart, countStr, totalStr) {

	var indexs = countStr.split(",");
	var count = 0;
	for ( var i = 0; i < indexs.length; i++) {
		var fund = $("#" + idStart + indexs[i]).text();
		if (!$.isNumeric(fund))
			fund = "0";
		count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
	}

	count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
	$("#" + idStart + totalStr).text(count);
}

function setEuipmentTotal(){
	var count = 1;
	var budget_pre_total = 0.00;
	var income_total = 0.00;
	var sale_total = 0.00;
	$("#tblEuipments tbody tr").each(function(){
		if(count!=1){//跳过第一行模版行
			var tr = $(this);
			var budget_pre = tr.find("input[id^='euipment_budget_pre']").first().val();
			var income = tr.find("input[id^='euipment_income']").first().val();
			var sale = tr.find("input[id^='euipment_sale']").first().val();
			if(budget_pre!=null && $.isNumeric(budget_pre)&& parseFloat(budget_pre)>0) budget_pre_total = parseFloat(budget_pre_total) + parseFloat(budget_pre);
			if(income!=null && $.isNumeric(income)&& parseFloat(income)>0) income_total = parseFloat(income_total) + parseFloat(income);
			if(sale!=null && $.isNumeric(sale)&& parseFloat(sale)>0) sale_total = parseFloat(sale_total) + parseFloat(sale);
		}
		count++;
	});
	$("#budget_pre_total").val(formatNumberAutoPro(budget_pre_total));
	$("#income_total").val(formatNumberAutoPro(income_total));
	$("#sale_total").val(formatNumberAutoPro(sale_total));
}
$(function(){
	$("#add1").text(formatVal($("#sell2").text().replace(new RegExp("\,","g"), "")-$("#sell1").val().replace(new RegExp("\,","g"), "")));
	if($("#sell1").val()==0 || $("#sell1").val() == ''){
		$("#increase1").text("0.00");
	}else{
	$("#increase1").text(formatVal(($("#sell2").text().replace(new RegExp("\,","g"), "")-$("#sell1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#sell1").val().replace(new RegExp("\,","g"), ""))));
	}
	$("#add2").text(formatVal($("#profit2").text().replace(new RegExp("\,","g"), "")-$("#profit1").val().replace(new RegExp("\,","g"), "")));
	if($("#profit1").val()==0 || $("#profit1").val() == ''){
		$("#increase2").text("0.00");
	}else{
	$("#increase2").text(formatVal(($("#profit2").text().replace(new RegExp("\,","g"), "")-$("#profit1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#profit1").val().replace(new RegExp("\,","g"), ""))));
	}
	
	$("#add3").text(formatVal($("#tax2").text().replace(new RegExp("\,","g"), "")-$("#tax1").val().replace(new RegExp("\,","g"), "")));
	if($("#tax1").val()==0 || $("#tax1").val() == ''){
		$("#increase1").text("0.00");
	}else{
	$("#increase3").text(formatVal(($("#tax2").text().replace(new RegExp("\,","g"), "")-$("#tax1").val().replace(new RegExp("\,","g"), ""))*100/Math.abs($("#tax1").val().replace(new RegExp("\,","g"), ""))));
	}
});

function formatNumberAutoPro(val){
	var count;
	if((formatNumberAuto(val.toString(), 9, 4, 2)*10000)%10000!=0)
		count=formatNumberAuto(val.toString()+'0000', 9, 4, 2);
	else
		count = formatNumberAuto(val.toString()+".0000", 9, 4, 2);
	return count;
}

</script>


